﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;

namespace SquareChaseBot
{
    /// <summary>
    /// Window API functions.
    /// </summary>
    internal static class Window
    {
        #region Read-only Fields

        internal static readonly IntPtr HWND_DESKTOP = IntPtr.Zero;

        #endregion

        #region Methods

        // Ref: http://msdn.microsoft.com/en-us/library/windows/desktop/ms633503%28v=vs.85%29.aspx
        [DllImport("user32.dll")]
        internal static extern bool GetClientRect(IntPtr hWnd, out RECT lpRect);

        // Ref: http://msdn.microsoft.com/en-us/library/dd145046.aspx
        // Ref: http://www.pinvoke.net/default.aspx/user32/MapWindowPoints.html
        [DllImport("user32.dll", SetLastError = true)]
        internal static extern int MapWindowPoints(IntPtr hwndFrom, 
            IntPtr hwndTo, 
            ref Point lpPoints, 
            [MarshalAs(UnmanagedType.U4)] int cPoints);

        // Ref: http://msdn.microsoft.com/en-us/library/dd145046.aspx
        // Ref: http://www.pinvoke.net/default.aspx/user32/MapWindowPoints.html
        [DllImport("user32.dll", SetLastError = true)]
        internal static extern int MapWindowPoints(IntPtr hwndFrom,
            IntPtr hwndTo,
            ref RECT lpPoints,
            [MarshalAs(UnmanagedType.U4)] int cPoints);
        
        #endregion
    }
}
